package chapter02;

import java.lang.reflect.Array;
import java.util.Arrays;

public class Test02_Insert {
    public static void main(String[] args) {
        //在6和4之间插入10
        int[] a = {1,2,3,6,4,5,78};
        //定义一个新数组 长度是原来的数组长度加1
        int[] b = new int[a.length+1];
        //把6之间的数字放入数组
        for(int i=0;i<4;i++){
            b[i] = a[i];
        }
        System.out.println(Arrays.toString(b));
        b[4] = 10;
        System.out.println(Arrays.toString(b));
        for(int i=4;i<a.length;i++){
            b[i+1] = a[i];
        }
        System.out.println(Arrays.toString(b));

    }
}
